<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 注意: 先引入 react基础库,再引入react dom解析库 -->
  <script src="lib/react/react.development.js"></script>
  <script src="lib/react/react-dom.development.js"></script>
  <script src="lib/babel.min.js"></script>
</head>
<body>
  <!-- 创建react解析的容器 -->
  <div id="root"></div>
  <script type="text/babel">
    
    
    class SideBarItems extends React.Component {
      render(){
        return (
          <ul>
            <li>首页</li>
            <li>用户管理</li>
            <li>商品管理</li>
            <li>内容管理</li>
          </ul>
        )
      }
    }
    class SideBar extends React.Component {
      constructor(props){
        super(props);
      }
      render(){
        return (
          <div>
            {this.props.children}  
          </div>
        )
      }
    }
    class Content extends React.Component {
      render(){
        return (
          <div>
            这是内容部分  
          </div>
        )
      }
    }
    class FootBar extends React.Component {
      render(){
        return (
          <div>
            这是底部部分  
          </div>
        )
      }
    }
    class BaseLayout extends React.Component {
      constructor(props){
        super(props);
      }
      render(){
        return (
          <div>
            {/*props.children是默认熟悉,指当前组件标签的内容部分*/}
            {this.props.children}
          </div>
        )
      }
    }


    class HelloWorld extends React.Component {
      render(){
        return (
          <div>
            {/*类似于vue的插槽slot */}
            <BaseLayout>
              <SideBar>
                <SideBarItems/>
              </SideBar>
              <Content/>
              <FootBar/>
            </BaseLayout>
          </div>
        )
      }
    }
    // 使用react 相关api 渲染到容器
    ReactDOM.render(<HelloWorld />,document.getElementById('root'));
  </script>
</body>
</html>